/**
 * <copyright>
 * </copyright>
 *

 */
package org.openarchitectureware.recipe2.dsl.recipeBuilder.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.openarchitectureware.recipe2.dsl.recipeBuilder.Import;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.PluginImport;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.PluginTemplate;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.PredefTemplate;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.PredefTemplatePackage;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.RecipeBuilderModel;
import org.openarchitectureware.recipe2.dsl.recipeBuilder.RecipeBuilderPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.openarchitectureware.recipe2.dsl.recipeBuilder.impl.RecipeBuilderModelImpl#getImports <em>Imports</em>}</li>
 *   <li>{@link org.openarchitectureware.recipe2.dsl.recipeBuilder.impl.RecipeBuilderModelImpl#getPluginImports <em>Plugin Imports</em>}</li>
 *   <li>{@link org.openarchitectureware.recipe2.dsl.recipeBuilder.impl.RecipeBuilderModelImpl#getPluginTemplates <em>Plugin Templates</em>}</li>
 *   <li>{@link org.openarchitectureware.recipe2.dsl.recipeBuilder.impl.RecipeBuilderModelImpl#getPredefTemplatePatterns <em>Predef Template Patterns</em>}</li>
 *   <li>{@link org.openarchitectureware.recipe2.dsl.recipeBuilder.impl.RecipeBuilderModelImpl#getPredefTemplates <em>Predef Templates</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RecipeBuilderModelImpl extends MinimalEObjectImpl.Container implements RecipeBuilderModel
{
  /**
   * The cached value of the '{@link #getImports() <em>Imports</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getImports()
   * @generated
   * @ordered
   */
  protected EList<Import> imports;

  /**
   * The cached value of the '{@link #getPluginImports() <em>Plugin Imports</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPluginImports()
   * @generated
   * @ordered
   */
  protected EList<PluginImport> pluginImports;

  /**
   * The cached value of the '{@link #getPluginTemplates() <em>Plugin Templates</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPluginTemplates()
   * @generated
   * @ordered
   */
  protected EList<PluginTemplate> pluginTemplates;

  /**
   * The cached value of the '{@link #getPredefTemplatePatterns() <em>Predef Template Patterns</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPredefTemplatePatterns()
   * @generated
   * @ordered
   */
  protected EList<PredefTemplatePackage> predefTemplatePatterns;

  /**
   * The cached value of the '{@link #getPredefTemplates() <em>Predef Templates</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPredefTemplates()
   * @generated
   * @ordered
   */
  protected EList<PredefTemplate> predefTemplates;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected RecipeBuilderModelImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return RecipeBuilderPackage.Literals.RECIPE_BUILDER_MODEL;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Import> getImports()
  {
    if (imports == null)
    {
      imports = new EObjectContainmentEList<Import>(Import.class, this, RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS);
    }
    return imports;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PluginImport> getPluginImports()
  {
    if (pluginImports == null)
    {
      pluginImports = new EObjectContainmentEList<PluginImport>(PluginImport.class, this, RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS);
    }
    return pluginImports;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PluginTemplate> getPluginTemplates()
  {
    if (pluginTemplates == null)
    {
      pluginTemplates = new EObjectContainmentEList<PluginTemplate>(PluginTemplate.class, this, RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES);
    }
    return pluginTemplates;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PredefTemplatePackage> getPredefTemplatePatterns()
  {
    if (predefTemplatePatterns == null)
    {
      predefTemplatePatterns = new EObjectContainmentEList<PredefTemplatePackage>(PredefTemplatePackage.class, this, RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS);
    }
    return predefTemplatePatterns;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PredefTemplate> getPredefTemplates()
  {
    if (predefTemplates == null)
    {
      predefTemplates = new EObjectContainmentEList<PredefTemplate>(PredefTemplate.class, this, RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES);
    }
    return predefTemplates;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS:
        return ((InternalEList<?>)getImports()).basicRemove(otherEnd, msgs);
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS:
        return ((InternalEList<?>)getPluginImports()).basicRemove(otherEnd, msgs);
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES:
        return ((InternalEList<?>)getPluginTemplates()).basicRemove(otherEnd, msgs);
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS:
        return ((InternalEList<?>)getPredefTemplatePatterns()).basicRemove(otherEnd, msgs);
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES:
        return ((InternalEList<?>)getPredefTemplates()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS:
        return getImports();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS:
        return getPluginImports();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES:
        return getPluginTemplates();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS:
        return getPredefTemplatePatterns();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES:
        return getPredefTemplates();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS:
        getImports().clear();
        getImports().addAll((Collection<? extends Import>)newValue);
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS:
        getPluginImports().clear();
        getPluginImports().addAll((Collection<? extends PluginImport>)newValue);
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES:
        getPluginTemplates().clear();
        getPluginTemplates().addAll((Collection<? extends PluginTemplate>)newValue);
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS:
        getPredefTemplatePatterns().clear();
        getPredefTemplatePatterns().addAll((Collection<? extends PredefTemplatePackage>)newValue);
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES:
        getPredefTemplates().clear();
        getPredefTemplates().addAll((Collection<? extends PredefTemplate>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS:
        getImports().clear();
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS:
        getPluginImports().clear();
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES:
        getPluginTemplates().clear();
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS:
        getPredefTemplatePatterns().clear();
        return;
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES:
        getPredefTemplates().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__IMPORTS:
        return imports != null && !imports.isEmpty();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_IMPORTS:
        return pluginImports != null && !pluginImports.isEmpty();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PLUGIN_TEMPLATES:
        return pluginTemplates != null && !pluginTemplates.isEmpty();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATE_PATTERNS:
        return predefTemplatePatterns != null && !predefTemplatePatterns.isEmpty();
      case RecipeBuilderPackage.RECIPE_BUILDER_MODEL__PREDEF_TEMPLATES:
        return predefTemplates != null && !predefTemplates.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //RecipeBuilderModelImpl
